<template>
  <div>
    {{msg}}
    <button v-on:click="list">点击</button>
    <table>
      <thead>
      <tr>
        <th>名称</th>
        <th>车牌号</th>
        <td>车辆二维码</td>
        <td>操作</td>
      </tr>
      </thead>
      <tbody>
      <tr v-for="item in carList">
        <td>{{item.carName}}</td>
        <td>{{item.carCode}}</td>
        <td>
          <img :src="item.carQrcode" alt="" width="100">
        </td>
        <td>
          <button @click="showInfo(item.carCode)">详情</button>
        </td>
      </tr>
      </tbody>
    </table>
  </div>
</template>

<script>
  export default {
    name: "Foo",
    methods: {
      list: function () {
        this.$axios.post("https://dakou.huimin888.cn/api/xcCarSale/queryXcCarInfoList").then(res => {
          var data = res.data;
          this.carList = data;
        })
      },
      showInfo(carCode){
        this.$axios.post("https://dakou.huimin888.cn/api/xcCarSale/getCarInfoByCode",this.$qs.stringify( {carCode:carCode})).then(res=>{
          console.log(res.data)
          alert(JSON.stringify(res.data))
        })
      }
    },
    data() {
      return {
        msg: 'Foo',
        carList: []
      }
    }
  }
</script>

<style scoped>

</style>
